<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>render</title>
  <script src="../../js/vue.js"></script>
</head>

<body>
  <div id="app">
    <!-- <ul v-if="items.length">
      <li v-for="item in items">{{ item.name }}</li>
    </ul>
    <p v-else>No items found.</p> -->
    <list :items='items'></list>
  </div>
  
  <script>
    Vue.component('list', {
      props: ['items'],
      render: function(createElement) {
        if (this.items.length) {
          return createElement('ul',
            this.items.map(function(item) {
              return createElement('li', item.name)
            }))
        } else {
          return createElement('p', 'No items found.')
        }
      }
    })

    let vm = new Vue({
      el: '#app',
      data() {
        return {
          items: [
            { name: '李逍遥' },
            { name: '赵灵儿' },
            { name: '林月如' },
            { name: '阿奴' }
          ]
        }
      },
    });
  </script>
</body>

</html>